<?php
/**
 * Description of FotoService
 *
 * @author laimis
 */
class GalleryService {
    private $galleryDAO;

    public function save($gallery){
        if($gallery->id != null){
            return $this->update($gallery);
        }else{
            return $this->insert($gallery);
        }
    }

    public function getAll(){
        return $this->galleryDAO->getAll();
    }

    public function getById($id){
        return $this->galleryDAO->getById($id);
    }

    public function insert($gallery){
        return $this->galleryDAO->insert($gallery);
    }

    public function update($gallery){
        $this->galleryDAO->update($gallery);
    }

    public function delete($id){
        $this->galleryDAO->delete($id);
    }

    public function GalleryService(){
        include_once BASEDAO;
        include_once GALLERYDAO;
        include_once GALLERYENTITY;
        $this->galleryDAO = new GalleryDAO();
    }
}
?>
